package com.lanyou.esb.datadictionary;

import java.rmi.NoSuchObjectException;

import org.apache.commons.lang3.StringUtils;

/**
 * 参数数据类型<br>
 * 描述：<br>
 * 0:String;1:double;2:int;3:boolean;4:byte;5:short;6:long;7:float;8:json;9:
 * object;10:file;11:date;
 * 
 * @author Davey.wu
 */
public enum IfParameterType {

	STRING("0", "String"), DOUBLE("1", "Double"), INT("2", "Int"), BOOLEAN("3",
			"Boolean"), BYTE("4", "Byte"), SHORT("5", "Short"), LONG("6",
			"Long"), FLOAT("7", "Float"), JSON("8", "Json"), OBJECT("9",
			"Object"), FILE("10", "File"), DATE("11", "Date");

	public static final String TypeCode = "20003";

	public final String ValueCode;
	public final String ValueName;

	private IfParameterType(String code, String valueName) {
		this.ValueCode = code;
		this.ValueName = valueName;
	}

	public static IfParameterType get(String valueCode)
			throws NoSuchObjectException {
		if (StringUtils.isEmpty(valueCode)) {
			throw new NullPointerException();
		}
		for (IfParameterType type : IfParameterType.values()) {
			if (type.ValueCode.equals(valueCode)) {
				return type;
			}
		}
		throw new NoSuchObjectException(valueCode);
	}
}
